package com.itljm.cxrMarket.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itljm.cxrMarket.entity.Categories;
import com.itljm.cxrMarket.service.CategoriesService;
import com.itljm.cxrMarket.mapper.CategoriesMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CategoriesServiceImpl extends ServiceImpl<CategoriesMapper, Categories> implements CategoriesService{
    @Autowired
    private CategoriesMapper categoriesMapper;

    @Override
    public List<Categories> selectCategoriesPage(Page<Categories> page, Wrapper<Categories> entityWrapper) {
        return categoriesMapper.selectCategoriesPage(page, entityWrapper);
    }

    @Override
    public List<Categories> selectAll() {
        return categoriesMapper.selectList(null);
    }

    @Override
    public boolean saveCategories(Categories entity) {
        return categoriesMapper.insertOrUpdate(entity);
    }

    @Override
    public Categories selectCategoriesById(Integer id) {
        return categoriesMapper.selectById(id);
    }

    @Override
    public Integer selectCategoriesIdByName(String name) {
        return categoriesMapper.selectCategoriesIdByName(name);
    }
}




